package install.ren.exercise.test.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @author zhuyunhui
 * @date 2020-05-20 11:35
 */
//@Component
public class SpringBootWebLifeCycle implements ApplicationListener<WebServerInitializedEvent>, ApplicationContextAware,InitializingBean {
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("SpringBootWebLifeCycle========================================SpringBootWebLifeCycle.InitializingBean");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("SpringBootWebLifeCycle========================================SpringBootWebLifeCycle.ApplicationContextAware");

    }

    @Override
    public void onApplicationEvent(WebServerInitializedEvent event) {
        System.out.println("SpringBootWebLifeCycle========================================WebServerInitializedEvent");
    }
}
